package com.flexcloudsdk.xmpp;

import java.util.logging.Logger;

import com.flexcloudsdk.xmpp.CloudPresence;
import com.google.appengine.api.xmpp.PresenceBuilder;
import com.google.appengine.api.xmpp.Presence;
import com.google.appengine.api.xmpp.PresenceShow;
import com.google.appengine.api.xmpp.PresenceType;
import com.google.appengine.api.xmpp.JID;

public class CloudPresenceBuilder {
   private static final Logger log = Logger.getLogger(CloudPresenceBuilder.class.getName());
   private  PresenceBuilder builder;
   
   public CloudPresenceBuilder() {
	   log.info("CloudPresenceBuilder has been created by BlazeDS");
	   builder = new PresenceBuilder();
   }

   public CloudPresence build() {
	   	Presence presence = builder.build();
	   	CloudPresence cloudPresence = new CloudPresence();
	   	cloudPresence.setPresence(presence);
	   	return cloudPresence;
   }
   
   public CloudPresenceBuilder withFromJid(JID fromJid) {
	    builder = builder.withFromJid(fromJid);
	    return this;
   }
   
   public CloudPresenceBuilder withPresenceShow(PresenceShow show) {
	   builder = builder.withPresenceShow(show);
	   return this;
   }

   public CloudPresenceBuilder withPresenceType(PresenceType type) {
	   builder = builder.withPresenceType(type);
	   return this;
   }
	
   public CloudPresenceBuilder withStatus(String status) {
	   builder = builder.withStatus(status);
	   return this;
   }

   public CloudPresenceBuilder withToJid(JID toJid) {
	   builder = builder.withToJid(toJid);
	   return this;
   }
}
